<script setup lang="ts">
import { getlouyudAPI } from '@/apis/enterprise';
import type { ApifoxModel, louyuData, louyuRow } from '@/types/enterprise';
import { onMounted, ref } from 'vue'

const params = ref<ApifoxModel>({
  name:'',
  page: '1',
  pageSize:'10',
  
})
const louyudata = ref<louyuData[]>([])
const total=ref(0)
const getlouyudata = async () => {
  const res = await getlouyudAPI(params.value)
  console.log(res);
  // louyudata.value = res.data.rows
  total.value=res.data.total
}
onMounted(() => {
  getlouyudata()
})
</script>

<template>
  <div class="building-container">
    <div class="search-container">
      <div class="search-label">楼宇名称:</div>
      <el-input clearable placeholder="请输入内容" class="search-main" />
      <el-button type="primary">查询</el-button>
    </div>
    <div class="create-container">
      <el-button type="primary">添加企业</el-button>
    </div>
    <div class="table">
      <!-- 新增：展开部分 -->
      <!-- @expand-change 展开或折叠行时触发 -->
      <el-table style="width: 100%" :data="louyudata" row-key="id">
        <el-table-column prop="id" type="index" label="序号" width="120" />
        <el-table-column prop="name" label="楼宇名称" width="320" />
        <el-table-column prop="floors" label="层数" />
        <el-table-column prop="area" label="在管面积" />
        <el-table-column prop="propertyFeePrice" label="物业费" />
        <el-table-column prop="status" label="状态" />
        <el-table-column label="操作">
          <template #default="{ row }">
            <el-button size="small" type="primary" >编辑</el-button>
            <el-button size="small" type="primary" >删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.building-container {
  padding: 20px;
}

.search-container {
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgb(237, 237, 237, .9);
  ;
  padding-bottom: 20px;

  .search-label {
    width: 100px;
  }

  .search-main {
    width: 220px;
    margin-right: 10px;
  }
}

.create-container {
  margin: 10px 0px;
}

.page-container {
  padding: 4px 0px;
  text-align: right;
}

.form-container {
  padding: 0px 80px;
}
</style>
